package aconcagua.measure

class ArithmeticObjectIntervalStrategy extends IntervalStrategy {

	// enumerating
	@Override
	public advance(aStart, aStep) {
		return aStart + aStep;
	}

	@Override
	public advance(aStart, aSteps, aStep) {
		return aStart + (aSteps * aStep);
	}

	@Override
	public steps(aStart, aStop, aStep) {
		return (aStop - aStart) / aStep;
	}

	// testing
	public isValidInterval(aStart, aStop, aStep) {
		return (aStep != 0) && {
			def steps = this.steps(aStart, aStop, aStep);
			!steps.isMeasureBag() && steps >= 0 };
	}
}
